Add support for all Diffie-Hellman Key Exchange protocols. #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for all Diffie-Hellman Key Exchange protocols.
In the SSH 2.0 protocol, there are roughly three different Diffie-Hellman key exchange protocols:
The Diffie-Hellman key exhange protocol depends on the KEX algorithms that has been negociated
during the Key Exchange Init stage.
This commit adds support for these three Diffie-Hellman key exchange protocols, by implementing
a new API called
SshKEX
.To use
SshKEX
, users must have retrieved theSshPacketKeyExchange
from the client and the server. Then,
SshKEX::init
is called to initializethe KEX stage.
Later, depending on the type of the messages that come,
SshKEX::parse_ssh_packet
is called to feed the pending KEX stage.
Finally, the various sub-stages specific to each DH key exchange protocols are
exposed through the
SshKEX
interface.Tests have been added to ensure that these three protocols are well supported.
If the feature flag
integers
is enabled, some sub-stages may exposeBigInt
instead of the integers in raw format.
No copy or no memory allocation is used here.